package com.jerry.provider.dao;

import com.jerry.common.bean.Ad;
import com.jerry.common.bean.Product;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AdDao {

	@Select("select * from t_ad")
	public List<Ad> findAll();
	
	@Select("select * from t_ad where id=#{id}")
	public Ad findById(Long id);
	
	@Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into t_ad(title,description) values(#{title},#{description})")
	public boolean add(Ad ad);
	
	@Update("update t_ad set title=#{title}, description=#{description} where id=#{id}")
	public boolean update(Ad ad);
	
	@Delete("delete from t_ad where id=#{id}")
	public void deleteById(Long id);

}
